package rush.edu.wechat.service.user.impl;


import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import rush.edu.wechat.facade.user.entity.User;
import rush.edu.wechat.facade.user.service.IUserService;
import rush.edu.wechat.service.user.dao.UserDao;

import java.util.List;

/**
 * <p>
 * 通用用户表 服务实现类
 * </p>
 *
 * @author 梅景飞
 * @since 2018-01-19
 */
@Service("userService")
public class UserServiceImpl extends ServiceImpl<UserDao, User> implements IUserService {

    @Autowired
    private UserDao userDao;

    @Override
    public List<User> findAll() {
        return userDao.selectList(null);
    }

    @Override
    public User findByEmail(String email) {
        EntityWrapper ew = new EntityWrapper<>();
        ew.where(" email ={0}",email);
        return this.selectOne(ew);
    }
}
